#include <iostream>
#include <gtest/gtest.h>

#include "RangePartitionMatcher.h"
#include "RangePartitionMatcherDemo.h"

// TEST(test_findPartitionByValue,SelectOne){
//         std::vector<RangePartition<int> > partitions = {
//         {"p0", 0, 10},
//         {"p2", 20, 30},
//         {"p1", 10, 20},
//         {"invalid", 50, 40}, // should be skipped
//         {"empty", 100, 100} // empty range
//     };
//     RangePartitionMatcherDemo matcher;
//     matcher.initial(partitions);

//     EXPECT_EQ(matcher.findPartitionByValue(8),"p0");
// }

// TEST(test_findPartitionByRange,SelectRange){
//         std::vector<RangePartition<int> > partitions = {
//         {"p0", 0, 10},
//         {"p2", 20, 30},
//         {"p1", 10, 20},
//         {"invalid", 50, 40}, // should be skipped
//         {"empty", 100, 100} // empty range
//     };
//     RangePartitionMatcherDemo matcher;
//     matcher.initial(partitions);

//     std::vector<std::string> vstring = {"p0","p1"};
//     EXPECT_EQ(matcher.findPartitionByRange(5,15),vstring);
// }

int main(int argc,char** argv) {
    std::cout << "Hello World, this is my first homework in Kingsoft Cloud Summer Camp 2025.";

    std::vector<RangePartition<int> > partitions = {
        {"p0", 0, 10},
        {"p2", 20, 30},
        {"p1", 10, 20},
        {"invalid", 50, 40}, // should be skipped
        {"empty", 100, 100} // empty range
    };
    RangePartitionMatcherDemo matcher;

    // todo some test cases.
    matcher.initial(partitions);
    std::vector<RangePartition<int> > output1 = matcher.getPartitions();
    // std::optional<std::string> output2 = matcher.findPartitionByVa1lue(8);
    std::string output2 = matcher.findPartitionByValue(8);
    std::vector<std::string> output3 = matcher.findPartitionByRange(5,15);

    std::cout << output2 << std::endl;
    for(auto& ot:output3)
    {
        std::cout << ot << " ";
    }
    std::cout << std::endl;

    return 0;

    // ::testing::InitGoogleTest(&argc, argv);
    // return RUN_ALL_TESTS();
}
